/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.historiaclinica.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.isn.atencionemergencia.entity.ResponsableDelPaciente;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "tipo_de_documento")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoDeDocumento.findAll", query = "SELECT t FROM TipoDeDocumento t"),
    @NamedQuery(name = "TipoDeDocumento.findByCodTipdocu", query = "SELECT t FROM TipoDeDocumento t WHERE t.codTipdocu = :codTipdocu"),
    @NamedQuery(name = "TipoDeDocumento.findByDescTipdocu", query = "SELECT t FROM TipoDeDocumento t WHERE t.descTipdocu = :descTipdocu")})
public class TipoDeDocumento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Tipdocu", columnDefinition="CHAR(5) unsigned")
    private String codTipdocu;
    @Column(name = "Desc_Tipdocu")
    private String descTipdocu;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codTipdocu")
    private Collection<ResponsableDelPaciente> responsableDelPacienteCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codTipdocu")
    private Collection<HistoriaClinica> historiaClinicaCollection;

    public TipoDeDocumento() {
    }

    public TipoDeDocumento(String codTipdocu) {
        this.codTipdocu = codTipdocu;
    }

    public String getCodTipdocu() {
        return codTipdocu;
    }

    public void setCodTipdocu(String codTipdocu) {
        this.codTipdocu = codTipdocu;
    }

    public String getDescTipdocu() {
        return descTipdocu;
    }

    public void setDescTipdocu(String descTipdocu) {
        this.descTipdocu = descTipdocu;
    }

    @XmlTransient
    public Collection<ResponsableDelPaciente> getResponsableDelPacienteCollection() {
        return responsableDelPacienteCollection;
    }

    public void setResponsableDelPacienteCollection(Collection<ResponsableDelPaciente> responsableDelPacienteCollection) {
        this.responsableDelPacienteCollection = responsableDelPacienteCollection;
    }

    @XmlTransient
    public Collection<HistoriaClinica> getHistoriaClinicaCollection() {
        return historiaClinicaCollection;
    }

    public void setHistoriaClinicaCollection(Collection<HistoriaClinica> historiaClinicaCollection) {
        this.historiaClinicaCollection = historiaClinicaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTipdocu != null ? codTipdocu.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoDeDocumento)) {
            return false;
        }
        TipoDeDocumento other = (TipoDeDocumento) object;
        if ((this.codTipdocu == null && other.codTipdocu != null) || (this.codTipdocu != null && !this.codTipdocu.equals(other.codTipdocu))) {
            return false;
        }
        return true;
    }
    
}
